package com.yx.robot.sdk.req;

public class BaseStationParam {

    private int lightType;
    private boolean lightSwitch;
    private int lightColor; //rgb 或者再加个饱和度
    private int brightness; //0-100
    private boolean airCleanerSwitch; //空气净化器开关
    private boolean plasmaSwitch; //空气净化器开关
    private int airCleaner;  //档位 1 2 3 4
    private int resetFilterType;  //

    private boolean hasset_light;
    private boolean hasset_airCleanerSwitch; //空气净化器开关
    private boolean hasset_plasmaSwitch; //空气净化器等离子开关
    private boolean hasset_airCleaner;  //档位 1 2 3 4
    private boolean hasset_resetFilter;  //是否重置滤芯寿命

    private BaseStationParam(Builder builder) {
        this.lightSwitch = builder.lightSwitch;
        this.lightType = builder.lightType;
        this.lightColor = builder.lightColor;
        this.brightness = builder.brightness;

        this.airCleanerSwitch = builder.airCleanerSwitch;
        this.airCleaner = builder.airCleaner;
        this.plasmaSwitch = builder.plasmaSwitch;
        this.resetFilterType = builder.resetFilterType;

        this.hasset_light = builder.hasset_light;

        this.hasset_airCleanerSwitch = builder.hasset_airCleanerSwitch;
        this.hasset_plasmaSwitch = builder.hasset_plasmaSwitch;
        this.hasset_airCleaner = builder.hasset_airCleaner;
        this.hasset_resetFilter = builder.hasset_resetFilter;
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public int getLightType() {
        return lightType;
    }

    public boolean getLightSwitch() {
        return lightSwitch;
    }

    public int getLightColor() {
        return lightColor;
    }

    public int getBrightness() {
        return brightness;
    }

    public boolean getAirCleanerSwitch() {
        return airCleanerSwitch;
    }

    public int getAirCleaner() {
        return airCleaner;
    }

    public boolean isHasset_light() {
        return hasset_light;
    }

    public boolean isHasset_airCleanerSwitch() {
        return hasset_airCleanerSwitch;
    }

    public boolean isHasset_airCleaner() {
        return hasset_airCleaner;
    }

    public int getResetFilterType() {
        return resetFilterType;
    }

    public boolean isHasset_resetFilter() {
        return hasset_resetFilter;
    }

    public boolean isPlasmaSwitch() {
        return plasmaSwitch;
    }

    public boolean isHasset_plasmaSwitch() {
        return hasset_plasmaSwitch;
    }

    public static final class Builder {
        private int lightType;
        private boolean lightSwitch;
        private int lightColor;
        private int brightness;
        private boolean airCleanerSwitch;
        private boolean plasmaSwitch;
        private int airCleaner;
        private int resetFilterType;


        private boolean hasset_light;
        private boolean hasset_airCleanerSwitch; //空气净化器开关
        private boolean hasset_plasmaSwitch; //空气净化器开关
        private boolean hasset_airCleaner;  //档位 1 2 3 4
        private boolean hasset_resetFilter;  //档位 1 2 3 4

        private Builder() {
        }

        public Builder light(boolean lightSwitch, int lightType, int lightColor, int brightness) {
            if (brightness < 1) {
                brightness = 1;
            }
            if (brightness > 100) {
                brightness = 100;
            }
            this.lightSwitch = lightSwitch;
            this.lightType = lightType;
            this.lightColor = lightColor;
            this.brightness = brightness;


            hasset_light = true;
            return this;
        }


        public Builder airCleanerSwitch(boolean airCleanerSwitch) {
            //空净 开时不开等离子 要关全关
            this.airCleanerSwitch = airCleanerSwitch;
            this.plasmaSwitch = false;

            hasset_plasmaSwitch = true;
            hasset_airCleanerSwitch = true;
            return this;
        }

        public Builder airCleaner(int airCleaner) {
            this.airCleaner = airCleaner;
            hasset_airCleaner = true;
            return this;
        }

        public Builder plasmaSwitch(boolean plasma) {
            //等离子开 空净开   等离子关 空净还是开
            this.plasmaSwitch = plasma;
            this.hasset_plasmaSwitch = true;
            this.airCleanerSwitch = true;
            this.hasset_airCleanerSwitch = true;
            return this;
        }

        public Builder setResetFilter(int resetFilterType) {
            this.resetFilterType = resetFilterType;
            hasset_resetFilter = true;
            return this;
        }

        public BaseStationParam build() {
            return new BaseStationParam(this);
        }
    }
}
